﻿'use strict';
/**
*common function 
*auth:lww
*version:1.0
*date:2014-10-11
*/ 
function randomcode() {
    var thedate = new Date();
    var code = Math.random().toString();
    code += thedate.getDay().toString();
    code += thedate.getHours().toString();
    code += thedate.getMinutes().toString();
    code += thedate.getSeconds().toString();
    code += thedate.getMilliseconds().toString();
    code = code.replace(".", "");
    return code;
}
/*
* base64 encode
*/
function base64encode(str) {
    var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
    var encoded = [];
    var c = 0;
    while (c < str.length) {
        var b0 = str.charCodeAt(c++);
        var b1 = str.charCodeAt(c++);
        var b2 = str.charCodeAt(c++);
        var buf = (b0 << 16) + ((b1 || 0) << 8) + (b2 || 0);
        var i0 = (buf & (63 << 18)) >> 18;
        var i1 = (buf & (63 << 12)) >> 12;
        var i2 = isNaN(b1) ? 64 : (buf & (63 << 6)) >> 6;
        var i3 = isNaN(b2) ? 64 : (buf & 63);
        encoded[encoded.length] = chars.charAt(i0);
        encoded[encoded.length] = chars.charAt(i1);
        encoded[encoded.length] = chars.charAt(i2);
        encoded[encoded.length] = chars.charAt(i3);
    }
    return encoded.join('');
}
/*
* base64 decode
*/
function base64decode(str) {
    var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
    var invalid = {
        strlen: (str.length % 4 != 0),
        chars: new RegExp('[^' + chars + ']').test(str),
        equals: (/=/.test(str) && (/=[^=]/.test(str) || /={3}/.test(str)))
    };
    if (invalid.strlen || invalid.chars || invalid.equals)
        return str;
    var decoded = [];
    var c = 0;
    while (c < str.length) {
        var i0 = chars.indexOf(str.charAt(c++));
        var i1 = chars.indexOf(str.charAt(c++));
        var i2 = chars.indexOf(str.charAt(c++));
        var i3 = chars.indexOf(str.charAt(c++));
        var buf = (i0 << 18) + (i1 << 12) + ((i2 & 63) << 6) + (i3 & 63);
        var b0 = (buf & (255 << 16)) >> 16;
        var b1 = (i2 == 64) ? -1 : (buf & (255 << 8)) >> 8;
        var b2 = (i3 == 64) ? -1 : (buf & 255);
        decoded[decoded.length] = String.fromCharCode(b0);
        if (b1 >= 0) decoded[decoded.length] = String.fromCharCode(b1);
        if (b2 >= 0) decoded[decoded.length] = String.fromCharCode(b2);
    }
    return decoded.join('');
}

function typeOf(obj) {
    if (obj == null) {
        return obj + "";
    }
    return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj;
}

function intval(v) {
    v = parseInt(v);
    return isNaN(v) ? 0 : v;
}

function tryParseInt(v, d) {
    v = parseInt(v);
    return isNaN(v) ? d : v;
}

function getStrLenWithGB(str) {
    return str.replace(/[^\x00-\xff]/g, "**").length;
}

function isNull(o) {
    return (!o && typeof (o) != "undefined" && o != 0);
}

function empty(str) {
    return (typeof (str) === "undefined" || isNull(str) || str == '' || str.length <= 0);
}

function isArray(obj) {
    return Object.prototype.toString.call(obj) === '[object Array]';
}

function isNumberStr(str) {
    if (empty(str)) {
        return false;
    }
    var reg = /^[0-9]*$/;
    return reg.test(str);
}
//validDate(yyyy-mm-dd)
function validDate(str) {
    if (empty(str)) {
        return false;
    }
    var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
    if (r == null) return false;
    var d = new Date(r[1], r[3] - 1, r[4]);
    return (d.getFullYear() == r[1] && (d.getMonth() + 1) == r[3] && d.getDate() == r[4]);
}
//validDateTime(YYYY-MM-DD HH:MM:SS)
function validDateTime(str) {
    if (empty(str)) {
        return false;
    }
    var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
    var r = str.match(reg);
    if (r == null) return false;
    var d = new Date(r[1], r[3] - 1, r[4], r[5], r[6], r[7]);
    return (d.getFullYear() == r[1] && (d.getMonth() + 1) == r[3] && d.getDate() == r[4] && d.getHours() == r[5] && d.getMinutes() == r[6] && d.getSeconds() == r[7]);
}
//get date
function getDate(timespan){
    var myDate = new Date(); 
    var tspan = tryParseInt(timespan,0);     
    myDate.setTime(myDate.getTime()+tspan);     
    var month = myDate.getMonth() + 1;
    var day = myDate.getDate();
    if(month < 10){
        month = "0"+month;
    }
    if(day < 10){
        day = "0"+day;
    }
    return myDate.getFullYear()+"-"+month+"-"+day;
}
/**
 * getDateTime
 * @param {*} timespan 
 * @param {*} fmt 
 */
function getDateTime(timespan,fmt){
    var myDate = new Date(); 
    var tspan = tryParseInt(timespan,0);     
    myDate.setTime(myDate.getTime()+tspan); 
    return dateFmt(fmt,myDate);   
}
/**
 * parseDateFmt
 * @param {*} str 
 * @param {*} fmt 
 */
function parseDateFmt(str,fmt){
    if(empty(str) || empty(fmt))  {
        return "";
    }   
    var retStr = "";
    var date = new Date();
    try{
        date = new Date(str);
        retStr = dateFmt(fmt,date);
    }catch(e){}
    return retStr;
}
/**
 * dateFmt
 * @param {*} fmt 
 * @param {*} date 
 */
function dateFmt(fmt,date) {     
    if(isNull(date) || empty(fmt))  {
        return "";
    }   
    var o = {
        "M+" : date.getMonth()+1,                  
        "d+" : date.getDate(),                     
        "H+" : date.getHours(),                     
        "m+" : date.getMinutes(),                    
        "s+" : date.getSeconds(),                    
        "q+" : Math.floor((date.getMonth()+3)/3), 
        "S"  : date.getMilliseconds()   
    };   
    if(/(y+)/.test(fmt)){
        fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); 
    }                    
    for(var k in o) {
        if(new RegExp("("+ k +")").test(fmt)){
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); 
        } 
    } 
    return fmt;   
}
/**
 * javaDateFmt
 * @param {*} date 
 * @returns 
 */
function javaDateFmt(date){
    return dateFmt("yyyy-MM-ddTHH:mm:ss.SZ",date);
} 
/**
*html element function
*auth:lww
*version:1.0
*date:2014-10-11
*update:2016-01-29
*/
function id() {
    var ids = randomcode();
    return "e" + ids;
}
function $e(oIDs) {
    return document.getElementById(oIDs.toString());
}
function $c(eleTag, eid) {
    var ole = document.createElement(eleTag);
    if (eid != null && eid != "" && typeof eid != 'undefined')
        ole.id = eid;
    else
        ole.id = id();
    return ole;
}
function $cc(eleTag, innerHtml) {
    var ole = document.createElement(eleTag);
    ole.innerHTML = innerHtml;       
    return ole;
}
function setChild(e,child){
    e.innerHTML = "";
    e.appendChild(child);
    return e;
}
function appendChild(e,child){    
    e.appendChild(child);
    return e;
}
function setCss(e, name) {
    e.className = name; 
    return e;   
}
function addCss(e, name) {
    if (e.className != "undefined" && e.className != null && e.className != "") {
        e.className += " " + name;
    }
    else {
        setCss(e, name);
    }
    return e;   
}
function rmCss(e, name) {
    e.className = e.className.replace(" " + name, "");
    return e;   
}
function setCssFloat(o, dir) {
    var ie = navigator.appName == "Microsoft Internet Explorer" ? true : false;
    if (ie)
        o.style.styleFloat = dir;
    else
        o.style.cssFloat = dir;
    return o;       
}
function hasCss(el, className) {
    if (el.classList){
        return el.classList.contains(className);
    }
    return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
}
function showEle(el,disp){
    if(el){
        el.style.display = disp;
    }
    return el;
}
//set ComputedStyle
if (!window.getComputedStyle) {
    window.getComputedStyle = function ($target) {
        return $target.currentStyle;
    };
}
//getElePos
function getElePos(e, ref_all) {
    var l = 0;
    var t = 0;
    var w = intval(e.style.width);
    var h = intval(e.style.height);
    var wb = e.offsetWidth;
    var hb = e.offsetHeight;
    if(ref_all){
        while (e.offsetParent) {
            l += e.offsetLeft + (e.currentStyle ? intval(e.currentStyle.borderLeftWidth) : 0);
            t += e.offsetTop + (e.currentStyle ? intval(e.currentStyle.borderTopWidth) : 0);
            e = e.offsetParent;
        }
    }   
    l += e.offsetLeft + (e.currentStyle ? intval(e.currentStyle.borderLeftWidth) : 0);
    t += e.offsetTop + (e.currentStyle ? intval(e.currentStyle.borderTopWidth) : 0);
    return { x: l, y: t, w: w, h: h, wb: wb, hb: hb };
}
function getEleScroll(e) {
    var t,l,w,h;
    if (e) {
        t = e.scrollTop;
        l = e.scrollLeft;
        w = e.scrollWidth;
        h = e.scrollHeight;
    } else {
        if (document.documentElement && document.documentElement.scrollTop) {
            t = document.documentElement.scrollTop;
            l = document.documentElement.scrollLeft;
            w = document.documentElement.scrollWidth;
            h = document.documentElement.scrollHeight;
        } else if (document.body) {
            t = document.body.scrollTop;
            l = document.body.scrollLeft;
            w = document.body.scrollWidth;
            h = document.body.scrollHeight;
        }
    }
    return { t: t, l: l, w: w, h: h };
}
function addEvent(elem, type, func) {
    var ret = false;
    if (typeof (elem.addEventListener) != 'undefined') {
        elem.addEventListener(type, func, false);
        ret = true;
    }
    else if (typeof (elem.attachEvent) != 'undefined') {
        elem.attachEvent('on' + type, func);
        ret = true;
    }
    return ret;
}
function delEvent(elem, event, func) {
    var ret = false;
    if (typeof (elem.removeEventListener) != 'undefined') {
        elem.removeEventListener(event, func, false);
        ret = true;
    }
    else if (typeof (elem.detachEvent) != 'undefined') {
        elem.detachEvent('on' + event, func);
        ret = true;
    }
    return ret;
}
function cancelBubble(e) {
    if (e.stopPropagation)
        e.stopPropagation();
    else
        e.cancelBubble = true;
}
function getMouseWheel(e) {
    var delta = 0;
    if (e.wheelDelta) { /* IE/Opera. */
        delta = e.wheelDelta / 120;
    } else if (e.detail) {
        /** Mozilla case. */
        /** In Mozilla, sign of delta is different than in IE. 
        * Also, delta is multiple of 3. 
        */
        delta = -e.detail / 3;
    }
    //return
    return delta;
}
function addMouseWheelEvent(o) {
    if (typeof (o) == 'undefined' || isNull(o) || typeof (o.onMouseWheelEvent) == 'undefined') {
        return false;
    }
    //define wheel event
    var wheel = function (e) {
        o.onMouseWheelEvent(e);
    };
    if (window.addEventListener) {
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', wheel, false);
    }
    /** IE/Opera. */
    window.onmousewheel = document.onmousewheel = wheel;
    return wheel;
}
function delMouseWheelEvent(func) {
    if (window.removeEventListener) {
        /** DOMMouseScroll is for mozilla. */
        window.removeEventListener('DOMMouseScroll', func, false);
    }
    /** IE/Opera. */
    window.onmousewheel = document.onmousewheel = null;
    return true;
}
/*
*fadeIn
*/
function fadeIn(el) {
    var opacity = 0;
    el.style.opacity = 0;
    el.style.filter = '';
    var last = +new Date();
    var tick = function () {
        opacity += (new Date() - last) / 400;
        el.style.opacity = opacity;
        el.style.filter = 'alpha(opacity=' + (100 * opacity) | 0 + ')';
        last = +new Date();
        if (opacity < 1) {
            (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
        }
    };
    tick();
}
/**
*each ,selector,fn(el,i)
*/
function each(selector, fn) {
    var elements = document.querySelectorAll(selector);
    Array.prototype.forEach.call(elements, fn);
}
/**************************************************
*  Drag function
*  fixed minor bug where events
*  sometimes fired off the handle, not the root.
**************************************************/
var Drag = {
    obj: null,
    init: function (o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) {
        o.onmousedown = Drag.start;
        o.onmouseout = Drag.end;

        o.hmode = bSwapHorzRef ? false : true;
        o.vmode = bSwapVertRef ? false : true;

        o.root = oRoot && oRoot != null ? oRoot : o;

        if (o.hmode && isNaN(parseInt(o.root.style.left))) o.root.style.left = "0px";
        if (o.vmode && isNaN(parseInt(o.root.style.top))) o.root.style.top = "0px";
        if (!o.hmode && isNaN(parseInt(o.root.style.right))) o.root.style.right = "0px";
        if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

        o.minX = typeof minX != 'undefined' ? minX : null;
        o.minY = typeof minY != 'undefined' ? minY : null;
        o.maxX = typeof maxX != 'undefined' ? maxX : null;
        o.maxY = typeof maxY != 'undefined' ? maxY : null;

        o.xMapper = fXMapper ? fXMapper : null;
        o.yMapper = fYMapper ? fYMapper : null;

        o.root.onDragStart = new Function();
        o.root.onDragEnd = new Function();
        o.root.onDrag = new Function();
    },

    cancel: function (o) {
        o.onmousedown = null;
    },

    start: function (e) {
        var o = Drag.obj = this;
        e = Drag.fixE(e);
        var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
        var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right);
        o.root.onDragStart(x, y);

        o.lastMouseX = e.clientX;
        o.lastMouseY = e.clientY;

        if (o.hmode) {
            if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
            if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
        } else {
            if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
            if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
        }

        if (o.vmode) {
            if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
            if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
        } else {
            if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
            if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
        }

        document.onmousemove = Drag.drag;
        document.onmouseup = Drag.end;

        return false;
    },

    drag: function (e) {
        e = Drag.fixE(e);
        var o = Drag.obj;

        var ey = e.clientY;
        var ex = e.clientX;
        var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
        var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right);
        var nx, ny;

        if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
        if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
        if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
        if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

        nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
        ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

        if (o.xMapper) nx = o.xMapper(y)
        else if (o.yMapper) ny = o.yMapper(x)

        Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
        Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
        Drag.obj.lastMouseX = ex;
        Drag.obj.lastMouseY = ey;

        Drag.obj.root.onDrag(nx, ny);

        return false;
    },

    end: function () {
        document.onmousemove = null;
        document.onmouseup = null;
        if (Drag.obj != null && typeof (Drag.obj) != 'undefined' && typeof (Drag.obj.root) != 'undefined') {
            Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
        }
        Drag.obj = null;
    },

    fixE: function (e) {
        if (typeof e == 'undefined') e = window.event;
        if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
        if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
        return e;
    }
};
window.dragInstance = Drag;
/**
*cosineTransform Math function class
*auth:lww
*version:1.0
*date:2014-10-11
*/
function CosineTransform() {
    this.version = "1.0.0";
    /*speed:duration*/
    this.duration = 600;
    this.steptime = 41;
    /*timer*/
    this.timer = null;
    this.t = (new Date).getTime();
    /*begin:args*/
    this.bv = 0;
    /*end:args*/
    this.ev = 0;
    /*args*/
    this.arg = null;
}
CosineTransform.prototype.star = function (b, e, a, s) {
    this.bv = b; this.ev = e; this.arg = a; this.duration = s;
    /*begin*/
    var z = this;
    z.t = (new Date).getTime();
    z.flag = true;
    z.step = function () {
        if (!z.flag) return;
        var t = (new Date).getTime();
        var p = (t - z.t) / z.duration;
        if (t >= z.duration + z.t) {
            z.flag = false;
            z.transform(z.ev);
            z.clear();
        } else {
            var v = ((-Math.cos(p * Math.PI) / 2) + 0.5) * (z.ev - z.bv) + z.bv;
            z.transform(v);
        }
    };
    z.transform = function (_v) { z.TransformStep(z.arg, _v); };
    z.clear = function () { clearInterval(z.timer); z.timer = null; z.Completed(z.arg); };
    z.timer = setInterval(function () { z.step(); }, z.steptime);
};
CosineTransform.prototype.TransformStep = function (a, v) { };
CosineTransform.prototype.Completed = function (a) { };
/**
 * Delayer
 * @param {*} t millis
 * @returns
 */
function delayer(){
    function Delayer(t){
        this.delayTime = t;
        this.startFlag = false;
    }
    Delayer.prototype.start=function(func){       
        this.execCode = func;
        this.startFlag = true;
        var othis = this;
        this.timer=window.setInterval(function(){
            othis.run();
        },this.delayTime); 
    };
    Delayer.prototype.run=function(){      
        if(this.startFlag){
            this.execCode();
            this.stop();
        }        
    };
    Delayer.prototype.stop=function(){
        this.startFlag = false;
        window.clearInterval(this.timer);
    };    
    return function(t){
        return new Delayer(t);
    };
}
//define delayer factory function
var delay = delayer();
/**************************************************
* window function
**************************************************/
function OpenWin(url, winName, width, height, isresizable, isscroll) {
    var xposition = 0, yposition = 0;
    if ((parseInt(navigator.appVersion) >= 4)) {
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    var theproperty = "width=" + width + ","
		+ "height=" + height + ","
		+ "location=0,"
		+ "menubar=0,"
		+ "resizable=" + isresizable + ","
		+ "scrollbars=" + isscroll + ","
		+ "status=0,"
		+ "titlebar=0,"
		+ "toolbar=0,"
		+ "hotkeys=0,"
		+ "screenx=" + xposition + "," //for Netscape
		+ "screeny=" + yposition + "," //for Netscape
		+ "left=" + xposition + "," //IE
		+ "top=" + yposition; //IE 
    var monwin = window.open(url, winName, theproperty);
    monwin.focus();
}
function OpenModalDialog(url, width, height, isscroll) {
    var returnvalue = "";
    var theproperty = "dialogWidth:" + width + ";"
		+ "dialogHeight:" + height + ";"
		+ "help:no;scroll:no;status:no";
    returnvalue = showModalDialog(url, window, theproperty);
    return returnvalue;
}
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        var c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            var c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}
function setCookie(c_name, value, time) {
    var exdate = new Date();
    exdate.setTime(exdate.getTime() + time);
    document.cookie = c_name + "=" + escape(value) + ((time == null) ? "" : ";expires=" + exdate.toGMTString());
}
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null) document.cookie = name + '=' + cval + ';expires=' + exp.toGMTString();
}
function goback() {
    window.history.back(-1);
}
function forward() {
    window.history.forward(1);
}
function getScreenWidth() {
    return screen.availWidth;
}
function getScreenHeight() {
    return screen.availHeight;
}
function getWinWidth() {
    return document.body.clientWidth
        || document.documentElement.clientWidth
        || window.innerWidth;
}
function getWinHeight() {
    return document.body.clientHeight
        || document.documentElement.clientHeight
        || window.innerHeight;
}
//resolve url params
var urlParams = new Object();
var aParams = document.location.search.substr(1).split('&');
for (var aParam of aParams) {
    var aParamPair = aParam.split('=');
    urlParams[aParamPair[0]] = aParamPair[1];
}
function getURLParams(name){
    return urlParams[name];
}
/*
 * document element function
 */
function setHtml(ele,htmlText){
    ele.innerHTML = htmlText;
    return ele;
}
function formatHtmlString(str, color, size, weight, margin, valign) {
    var s = $c("span", id());
    s.innerHTML = str;
    s.style.display = "inline-block";    
    if(color){ s.style.color = color; }  
    if(size){ s.style.fontSize = size; }    
    if(weight){ s.style.fontWeight = weight; }    
    if(margin){ s.style.margin = margin; } 
    if (typeof (valign) != 'undefined' && valign != null) {
        s.style.verticalAlign = valign;
    }
    else {
        s.style.verticalAlign = "middle";
    }   
    return s;
}
function formatHtmlIco(src, w, h, margin, tipinfo, align) {
    var o = $c("img", id());
    o.src = src;
    o.style.width = w;
    o.style.height = h;
    o.style.border = "0";
    o.style.margin = margin;
    o.style.verticalAlign = "middle";
    if (typeof (align) != 'undefined' && align != null) {
        o.style.float = align;
    }
    if (typeof (tipinfo) != 'undefined' && tipinfo != null) {
        o.alt = tipinfo.replace(/&nbsp;/g, '');
        o.title = o.alt;
    }
    return o;
}
function createInput(type, text, w, h, margin, tipinfo, align) {
    var o = $c("input", id());
    o.type = type;
    o.value = text;
    o.style.width = w;
    o.style.height = h;
    if(margin){o.style.margin = margin;}
    if(align){o.style.align = align;}
    o.style.verticalAlign = "middle";
    if (typeof (tipinfo) != 'undefined' && tipinfo != null) {
        o.title = tipinfo;
    }
    return o;
}
function createLinkBtn(ele, onlink, linkParms, clsName) {
    var linkBtn = $c("a", id());
    setChild(linkBtn,ele);
    if(clsName){ linkBtn.className = clsName;}    
    linkBtn.href = "#";
    linkBtn.onclick = function(){
        onlink(linkParms);
    };
    return linkBtn;
}
function createButton(ele, fnclick, parms, clsName) {
    var btn = $c("button");
    setChild(btn,ele);
    if(clsName) { btn.className = clsName; }
    btn.onclick = function(){
        fnclick(parms);    
    };
    return btn;
}

markscript("common");
//end common.js